<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isErrorPage="true" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page import="com.crowdgeeks.model.User" %>
<%@ page import="java.util.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta name="description" content="Bean's Twitter client, an OAuth enabled Twitter client.">
        <meta name="keywords" content="twitter, client, oauth">
        <title>Bean's Twitter Client</title>
        <script src="/js/jquery-1.5.min.js"></script>
        <script type="text/javascript">
        <!--
        function goTimeline(id) {
            document.location.href="/twitter/timeline?id="+id;
        }

        function goDelete(id) {
        	document.location.href="/user/delete?id="+id;
        }
        -->
        </script>
    </head>
    <body>
        <form name="frm" id="frm">
            <input type="hidden" name="id" id="id"/>
        </form>
        
        <h3>Bean's Twitter Client list</h3>
<%
List<User>list = (List<User>)request.getAttribute("userList");
if(list !=null && list.size() > 0) {
%>
<table>
<%   for (int i = 0; i < list.size(); i++) {
       User user = list.get(i);
 %>
  <tr style="font-size:80%;">
    <td><b><a href="javascript:goTimeline('<%=user.getId()%>')"><%=user.getId()%></a></b></td>
    <td><%= user.getTwitterId() %></td>
    <td><%= user.getTwitterScreenName() %></td>
    <td><a href="javascript:goDelete('<%=user.getId()%>');">delete</a></td>
  </tr>
<%
     }
 %>
</table>
<%
}
%>
<%--
        <c:if test="${userList}">
            <table>
            <c:forEach items="${userList}" var="list">
                <tr style="font-size:80%;">
                    <td><b><a href="goTimeline('id')">${list.id}</a></b></td>
                    <td>${list.twitterId}</td>
                    <td>${list.twitterScreenName}</td>
                    <td><a href="javascript:goDelete('${list.id}');">delete</a></td>
                </tr>
            </c:forEach>
            </table>
        </c:if>
 --%>        
    </body>
</html>